var _int;   //定时器
var rules = {
    mobile: {
        required: true,
        isMobile:true
    },
    code:"required",
    password:{
        required: true,
        minlength: 6,
        maxlength:16,
    },
    againPassword:{
        required: true,
        minlength: 6,
        maxlength:16,
        someData:true
    }
    
}
var messages = {
    mobile:{
        required:"请输入手机号",
        isMobile:"请输入正确的手机格式！"
    },
    code:'请输入验证码',
    password:{
        minlength: "长度不得小于6位",
        maxlength:"长度不得大于16位",
    },
    againPassword:{
        minlength: "长度不得小于6位",
        maxlength:"长度不得大于16位",
        someData:"两次输入的密码必须一致"
    }
}

// 发送验证码
function timeClock(cls) {
    var _this = cls;
  
    if (_this.hasClass('disabled')) {
      return false;
    } else {
      var clock = function clock() {
        _this.text("重新发送(" + i + ")");
  
        i--;
  
        if (i < 0) {
            clearYzm(_this)
        }
      };
  
      _this.addClass('disabled');
  
      var i = 59;
  
      _int = setInterval(clock, 1000);
  
      return false;
    }
  } 

  function clearYzm(cls){
    var _this = cls;
    _this.removeClass('disabled');
  
    i = 59;

    _this.text("获取验证码");

    clearInterval(_int);
  }